/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.appspot.trick.it.admin.task;

import com.appspot.trick.it.admin.api.GaeArticleAPIService;
import com.appspot.trick.it.admin.controller.MainController;
import com.appspot.trick.it.admin.model.ArticleModel;
import java.util.List;
import javafx.concurrent.Service;
import javafx.concurrent.Task;

/**
 *
 * @author takahara
 */
public class ArticleChangeIndexTask extends Service<Void> {
    
    private List<ArticleModel> keysList;


    /**
     * コンストラクタ
     *
     * @param keysList
     */
    public void run(List<ArticleModel> keysList) {
        this.keysList = keysList;
        this.restart();
    }

    @Override
    protected Task<Void> createTask() {
        return new Task<Void>() {

            @Override
            protected Void call() throws Exception {
                GaeArticleAPIService service = new GaeArticleAPIService(MainController.getInstance().getSiteMstEntity());
                service.changeIndexs(keysList);

                return null;
            }
        };

    }

}
